<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> </title>
</head>
<body>
<script>
    //顺序结构
    console.log('1');
    console.log('2');
    console.log('3');
    //分支结构
    let un='t';
    if(!un){
        alert('请登录')
    }else{
        alert('已登录')
    }
    //选择结构
    let a=1;
    switch (a){
        case 1:
            console.log('DA');
            break;
        case 2:
            console.log('XIAO');
            break;
        default:
            console.log('NONONO');
            break;
    }
    //循环结构
    let name=['1','2','3'];
    for(var i=0;i<name.length;i++){
        console.log(i);
    }
    //如果用var定义循环变量I，则I会一直保存，出循环后可打印出i的值
    //如果用lat定义i，出循环后无法打印出i的值

    //增强for循环，遍历数组
    for(let n of name)
    {console.log(n);}
</script>
</body>
</html>